/**
 * create time : 2010-5-21
 * author : david
 */
package com.xbang.core.page;

import java.io.Serializable;

import com.opensymphony.xwork2.ActionContext;

/**
 * @author Administrator
 * 
 */
public class Page implements Serializable {

	private static final long serialVersionUID = -2963147923231944938L;
	
	private String selectCheckIds;
	
	private String actionURI;

	/** 存在前一个Page */
	private boolean previousPage;

	/** 存在下一个Page */
	private boolean nextPage;

	/** 当前page */
	private int currentPage;

	/** 每个page页有多少条数据 */
	private int everyPageSize = 20;

	/** 总共有多少个Page */
	private int totalPage;

	/** 数据库中起始的记录 */
	private int beginIndex;

	public Page() {
	}

	public Page(ActionContext ctx){
		
	}
	/**
	 * @param everyPageSize
	 */
	public Page(int everyPageSize) {
		this.everyPageSize = everyPageSize;
	}

	/**
	 * @param everyPageSize
	 */
	public Page(int currentPage, int everyPageSize) {
		this.everyPageSize = everyPageSize;
		this.currentPage = currentPage;
	}

	/**
	 * @param currentPage
	 * @param everyPageSize
	 * @param totalPage
	 */
	public Page(int currentPage, int everyPageSize, int totalPage) {
		this.currentPage = currentPage;
		this.everyPageSize = everyPageSize;
		this.totalPage = totalPage;
	}

	/**
	 * @param previousPage
	 * @param nextPage
	 * @param currentPage
	 * @param everyPageSize
	 * @param totalPage
	 */
	public Page(boolean previousPage, boolean nextPage, int currentPage, int everyPageSize, int totalPage) {
		this(previousPage, nextPage, currentPage, everyPageSize, totalPage, PageUtils.getBeginIndex(everyPageSize, currentPage));
	}

	/**
	 * @param previousPage
	 * @param nextPage
	 * @param currentPage
	 * @param everyPageSize
	 * @param totalPage
	 * @param beginIndex
	 */
	public Page(boolean previousPage, boolean nextPage, int currentPage, int everyPageSize, int totalPage, int beginIndex) {
		this.previousPage = previousPage;
		this.nextPage = nextPage;
		this.currentPage = currentPage;
		this.everyPageSize = everyPageSize;
		this.totalPage = totalPage;
		this.beginIndex = beginIndex;
	}

	/**
	 * @return the previousPage
	 */
	public boolean isPreviousPage() {
		return previousPage;
	}

	/**
	 * @param previousPage
	 *            the previousPage to set
	 */
	public void setPreviousPage(boolean previousPage) {
		this.previousPage = previousPage;
	}

	/**
	 * @return the nextPage
	 */
	public boolean isNextPage() {
		return nextPage;
	}

	/**
	 * @param nextPage
	 *            the nextPage to set
	 */
	public void setNextPage(boolean nextPage) {
		this.nextPage = nextPage;
	}

	/**
	 * @return the currentPage
	 */
	public int getCurrentPage() {
		return currentPage;
	}

	/**
	 * @param currentPage
	 *            the currentPage to set
	 */
	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}

	/**
	 * @return the everyPageSize
	 */
	public int getEveryPageSize() {
		return everyPageSize;
	}

	/**
	 * @param everyPageSize
	 *            the everyPageSize to set
	 */
	public void setEveryPageSize(int everyPageSize) {
		this.everyPageSize = everyPageSize;
	}

	/**
	 * @return the totalPage
	 */
	public int getTotalPage() {
		return totalPage;
	}

	/**
	 * @param totalPage
	 *            the totalPage to set
	 */
	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}

	/**
	 * @return the beginIndex
	 */
	public int getBeginIndex() {
		return beginIndex;
	}

	/**
	 * @param beginIndex
	 *            the beginIndex to set
	 */
	public void setBeginIndex(int beginIndex) {
		this.beginIndex = beginIndex;
	}

	public boolean getNextPage() {
		return nextPage;
	}

	public boolean getPrePage() {
		return previousPage;
	}

	/**
	 * @return the selectCheckIds
	 */
	public String getSelectCheckIds() {
		return selectCheckIds;
	}

	/**
	 * @param selectCheckIds the selectCheckIds to set
	 */
	public void setSelectCheckIds(String selectCheckIds) {
		this.selectCheckIds = selectCheckIds;
	}

	/**
	 * @return the actionURI
	 */
	public String getActionURI() {
		return actionURI;
	}

	/**
	 * @param actionURI the actionURI to set
	 */
	public void setActionURI(String actionURI) {
		this.actionURI = actionURI;
	}

	
}
